import streamlit as st
import os
from agent import main
from get_dy_hot import login
from get_dy_hot import main as get_hot_data



st.title('龙哥画手抖音热搜选题工具')

with st.sidebar:
    # 登录抖音
    if st.button('登录抖音'):
        login()

if st.button('生成选题'):
    with st.spinner('正在获取抖音热搜和实时上升热搜'):
        today_hot, upping_hot = get_hot_data()
        for thot in today_hot:
            st.markdown(f'**今日热搜**：{thot}')
        for uhot in upping_hot:
            st.markdown(f'**实时上升热搜**：{uhot}')
    st.markdown('选题')
    with st.spinner('正在分析抖音热搜数据，生成选题中...'):
        response = main()
    st.write(response)